import { PiniaOidcClientSettings } from 'pinia-oidc/types/oidc'
import { getAppEnvConfig } from '@/utils/env'

export const getOidcClientSettings = (): PiniaOidcClientSettings => {
  const ENV = getAppEnvConfig()
  return {
    client_id: ENV.VITE_GLOB_OIDC_CLIENT_ID,
    client_secret: ENV.VITE_GLOB_OIDC_CLIENT_SECRET,
    scope: ENV.VITE_GLOB_OIDC_CLIENT_SCOPE,
    authority: ENV.VITE_GLOB_OIDC_URL,
    redirect_uri: `${window.location.origin}/oidc-callback`,
    post_logout_redirect_uri: `${window.location.origin}/signout-callback-oidc`,
    automaticSilentRenew: true,
    automaticSilentSignin: true,
    response_type: 'code',
  }
}
